#ifndef LEAFDATABASE_H
#define LEAFDATABASE_H

#include <vector>
#include <QStringList>

class LeafDatabase
{
public:
    ~LeafDatabase();

    typedef struct{
        std::string type;
        std::string name;
        std::string filename;
        std::string full_path;
        std::string segmented_full_path;
        std::vector<float> arclength_feature;
        std::vector<float> area_feature;
        unsigned int id;
    } Entry;

    std::vector<QStringList> arclength_feature_csv;
    std::vector<QStringList> area_feature_csv;
    std::vector<Entry> features;

    static float distance(const std::vector<float>& feature1,const std::vector<float>& feature2);
    std::vector<Entry*> closestNEntries(const std::vector<float>& query_arclength_feature,const std::vector<float>& query_area_feature,int N=25,int ignore_id=-1);
    std::vector<Entry*> closestNEntries(int feature_id,int N=25);

    static LeafDatabase* GetInstance(){return &mInstance;}
private:
    static LeafDatabase mInstance;
    LeafDatabase();
};

#endif // LEAFDATABASE_H
